jade.tools.sniffer
Class Sniffer

java.lang.Object
  |
  +--jade.core.Agent
        |
        +--jade.tools.ToolAgent
              |
              +--jade.tools.sniffer.Sniffer

public class Sniffer
extends jade.tools.ToolAgent

This is the Sniffer agent.
This class implements the low level part of the Sniffer, interacting with Jade environment and with the sniffer GUI.
At startup, the sniffer subscribes itself as an rma to be informed every time an agent is born or dead, a container is created or deleted.
For more information see Introduction to the Sniffer Javadoc documentation for the file

Author:
Alessandro Beneventi (Developement), Gianluca Tanca (Concept & Early Version), Robert Kessler, University of Utah Added the ability to have a configuration file (snifferagentname.inf) which allows you to specify agents that should be sniffed as soon as they appear. The file contains a line by line list of agent names (if there is no @ in the name, it assumes the current HAP for it). Following the agent name is an optional list of performatives that the sniffer will sniff. If the list is not present, then the sniffer will display all messages. Otherwise, only those messages that have a matching performative mentioned will be displayed. A typical file might contain: da0 da1 inform propose sniffer0@disjunior:1099/JADE Note - the file is looked for in the current directory, and if not found, it scans for the file at the top level directory (/snifferagentname.inf) One other change was made to the system - that is the performative of the message is now displayed above each message. This gives additional information to the user so they can see exactly what is happening dynamically. More changes - M. Griss changed the display to include information about the conversation id and other ids. He also enhanced the one click information at the bottom. R. Kessler changed MainPanel, so the scrollPane has a column header, which is the agent canvas list. Now when it scrolls down, the agents stay on top. This functionality required changes to: Sniffer (read the file, when an agent is born - see if in the list and auto sniff, and when a message arrives - determine if it should be displayed or not); MainWindow (made the ActionProcessor local variable public so we can get a hold of the code in DoSniffAction); DoSniffAction (modified so there is a new method doSniff - which takes an agent name and does the actual sniffing - I broke this out from the doAction method); MMCanvas (added the ability to display the performative name above the message). Some notes: 1-if a message is one that is to be ignored, then it is dropped totally. If you look at the sniffer dump of messages, it will not be there. Might want to change this. 2-Should develop a GUI to allow dynamically setting which messages are filtered instead of forcing them to be in the .inf file. 3-Probably should allow one to turn on and off the display of the performative name. Although, it seems pretty nice to have this information and although one might consider that it clutters the display, it sure provides a lot of information with it. 4-Since we can now sniff agents when they appear, you could imagine another option that would allow you to turn on a sniff all new agents flag.
See Also:
Serialized Form

Inner classes inherited from class jade.tools.ToolAgent
jade.tools.ToolAgent.AMSListenerBehaviour, jade.tools.ToolAgent.EventHandler
 
Field Summary
static boolean SNIFF_OFF
           
static boolean SNIFF_ON
           
 
Fields inherited from class jade.core.Agent
AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_TRANSIT, AP_WAITING, currentBehaviour, currentMessage, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN, MSG_QUEUE_SIZE
 
Constructor Summary
Sniffer()
           
 
Method Summary
 jade.lang.acl.ACLMessage getSniffMsg(jade.util.leap.List agents, boolean onFlag)
          Creates the ACLMessage to be sent to the Ams with the list of the agent to be sniffed/unsniffed.
 void sniffMsg(jade.util.leap.List agents, boolean onFlag)
          This method add an AMSBehaviour the perform a request to the AMS for sniffing/unsniffing list of agents.
 void toolSetup()
          ACLMessages for subscription and unsubscription as rma are created and corresponding behaviours are set up.
protected  void toolTakeDown()
          Cleanup during agent shutdown.
 
Methods inherited from class jade.tools.ToolAgent
getCancel, getRequest, getSubscribe, setup, takeDown
 
Methods inherited from class jade.core.Agent
addBehaviour, afterClone, afterMove, beforeClone, beforeMove, blockingReceive, blockingReceive, blockingReceive, blockingReceive, deregisterLanguage, deregisterOntology, doActivate, doClone, doDelete, doMove, doStart, doSuspend, doWait, doWait, doWake, extractContent, extractMsgContent, fillContent, fillMsgContent, getAID, getAMS, getArguments, getContentManager, getDefaultDF, getHap, getLocalName, getName, getQueueSize, getState, here, lookupLanguage, lookupOntology, notifyRestarted, postMessage, putBack, read, read, receive, receive, registerLanguage, registerOntology, removeBehaviour, restartLater, restore, run, send, setArguments, setArguments, setQueueSize, waitUntilStarted, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNIFF_ON

public static final boolean SNIFF_ON

SNIFF_OFF

public static final boolean SNIFF_OFF
Constructor Detail

Sniffer

public Sniffer()
Method Detail

toolSetup

public void toolSetup()
ACLMessages for subscription and unsubscription as rma are created and corresponding behaviours are set up.
Overrides:
toolSetup in class jade.tools.ToolAgent

toolTakeDown

protected void toolTakeDown()
Cleanup during agent shutdown. This method cleans things up when Sniffer agent is destroyed, disconnecting from AMS agent and closing down the Sniffer administration GUI. Currently sniffed agents are also unsniffed to avoid errors.
Overrides:
toolTakeDown in class jade.tools.ToolAgent

sniffMsg

public void sniffMsg(jade.util.leap.List agents,
                     boolean onFlag)
This method add an AMSBehaviour the perform a request to the AMS for sniffing/unsniffing list of agents.

getSniffMsg

public jade.lang.acl.ACLMessage getSniffMsg(jade.util.leap.List agents,
                                            boolean onFlag)
Creates the ACLMessage to be sent to the Ams with the list of the agent to be sniffed/unsniffed. The internal list of sniffed agents is also updated.
Parameters:
agentVect - vector containing TreeData item representing the agents
onFlag - can be:
  • Sniffer.SNIFF_ON to activate sniffer on an agent/group
  • Sniffer.SNIFF_OFF to deactivate sniffer on an agent/group